package com.tanhua.dubbo.api.mongo;

import com.tanhua.domain.mongo.TestOptions;
import com.tanhua.dubbo.utils.IdService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;

@Service
public class OptionApiImpl implements OptionApi {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Autowired
    private IdService idService;

    @Override
    public void save(TestOptions options) {
        options.setType("3");
        options.setOptionId(idService.getNextId("test_options"));
        mongoTemplate.save(options);
    }
}
